<?php
session_start();
require ('../classes/Conf.php');
require ('../classes/ConnectionSecure.php');
include ('../validar_sesion.php');
if ($logueado) {
    switch ($rolUsuario['Rol']) {        
        case '2': {
                header("Location:../index.php");
                break;
            }
    }
}

require ('../classes/Connection.php');
require ('../classes/Usuarios.php');
require ('../classes/Transacciones.php');
?>



<!DOCTYPE html>
<html class="no-js">
    <head>
        <meta charset="utf-8">        
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width">
        <meta name="author" content="templatemo">
        <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,800,700,600,300' rel='stylesheet' type='text/css'>

        <link rel="stylesheet" href="../resources/css/bootstrap.min.css">
        <link rel="stylesheet" href="../resources/css/font-awesome.css">
        <link rel="stylesheet" href="../resources/css/animate.css">
        <link rel="stylesheet" href="../resources/css/templatemo_misc.css">
        <link rel="stylesheet" href="../resources/css/templatemo_style.css">

        <script src="../resources/js/vendor/modernizr-2.6.1-respond-1.1.0.min.js"></script>
        <link href="../template/css/bootstrap.min.css" rel="stylesheet"> 
    </head>
    <body>



        <div class="site-header">
            <div class="container">
                <div class="main-header">
                    <div class="row">
                        <div class="col-md-4 col-sm-6 col-xs-10">
                            <div class="logo">
                                <a rel="nofollow" href="http://www.templatemo.com/preview/templatemo_409_travel">
                                    <img src="../resources/images/logoBanqueaChevere.png" alt="travel by templatemo" title="travel - free html5 template">
                                </a>
                            </div> <!-- /.logo -->
                        </div> <!-- /.col-md-4 -->
                        <div class="col-md-8 col-sm-6 col-xs-2">
                            <div class="main-menu">
                                <ul class="visible-lg visible-md">
                                   <li><a href="../index.php">Home</a></li>
                                    <li><a href="crearCuenta.php">Crear Cuenta</a></li>                                   
                                    <li><a href="aprobarTransaccion.php">Aprobar T</a></li>                                   
                                    <li class="active"><a href="aprobarRegistroUsuario.php">Aprobar U</a></li>                                   
                                    <li><a href="../salir.php">Salir</a></li>                                     
                                </ul>
                                <a href="#" class="toggle-menu visible-sm visible-xs">
                                    <i class="fa fa-bars"></i>
                                </a>
                            </div> <!-- /.main-menu -->
                        </div> <!-- /.col-md-8 -->
                    </div> <!-- /.row -->
                </div> <!-- /.main-header -->
                <div class="row">
                    <div class="col-md-12 visible-sm visible-xs">
                        <div class="menu-responsive">
                            <ul>
                              <li><a href="../index.php">Home</a></li>
                                    <li><a href="crearCuenta.php">Crear Cuenta</a></li>                                   
                                    <li><a href="aprobarTransaccion.php">Aprobar T</a></li>                                   
                                    <li class="active"><a href="aprobarRegistroUsuario.php">Aprobar U</a></li>                                   
                                    <li><a href="../salir.php">Salir</a></li>                                     
                            </ul>
                        </div> <!-- /.menu-responsive -->
                    </div> <!-- /.col-md-12 -->
                </div> <!-- /.row -->
            </div> <!-- /.container -->
        </div> <!-- /.site-header -->

        <div class="page-top" id="templatemo_contact">
        </div> <!-- /.page-header -->

        <div class="contact-page">
            <div class="container">
                <div class="row">

                    <div class="col-md-5 col-sm-6">
                        
                       <div class="container theme-showcase" role="main">
            <div class="jumbotron">
                <h3>Aprobaci&oacute;n de Registro de Usuarios</h3>
            </div>

            <center><a href="../index.php">Regresar...</a><p><a href="../salir.php">Salir</a></center>

            <?php
            $obj = new Usuarios();
            $result = $obj->consultarUsuariosInactivos();

            if (mysql_num_rows($result) > 0) {
                ?>
                <form action="aprobarRegistroUsuario.php" method="post" enctype="multipart/form-data" id="myForm">
                    <?php
                    echo "<table class='table'>";
                    echo '<tr  class="success">';
                    echo "<td><strong>#</strong></td>" . "<td><strong>Id</strong></td>" . "<td><strong>Username</strong></td>" . "<td><strong>Nombre</strong></td>" . "<td><strong>Apellidos</strong></td>" . "<td><strong>Email</strong></td>";
                    echo '</tr>';
                    while ($fila = mysql_fetch_assoc($result)) {
                        echo '<tr>';
                        echo "<td><input style=inline type='radio' name='ids[]' value='{$fila['id']}'></td>" . "<td>{$fila['id']}</td>" . "<td>{$fila['Username']}</td>" . "<td>{$fila['Nombres']}</td>" . "<td>{$fila['Apellidos']}</td>" . "<td>{$fila['Email']}</td>";
                        echo '</tr>';
                    }
                    echo "</table>";
                    echo "<button type='submit' name='submit' class='btn btn-success'>Aprobar</button>";
                    ?>
                </form>
                <?php
            } else {
                ?>
                <div class="alert alert-warning">
                    <strong>No hay usuarios por aprobar</strong>
                </div>
                <?php
            }

            if (isset($_POST["submit"])) {
                foreach (@$_POST[ids] as $ids) {

                    $transac = new Usuarios();
                    $transac->aprobar($ids);
                    ?>            

                    <script>
                        alert("Transaccion aprobada!");
                        location.href=window.location;
                    </script>


                    <?php
                }
            }
            ?>
        </div>
                    </div>
                </div>
            </div>
        </div>




        

        <div class="site-footer">
            <div class="container">
                <div class="row">
                    <div class="col-md-4 col-sm-4">
                        <div class="footer-logo">
                            <a href="index.html">
                                <img src="../resources/images/logoBanqueaChevere.png" alt="">
                            </a>
                        </div>
                    </div> <!-- /.col-md-4 -->
                    <div class="col-md-4 col-sm-4">
                        <div class="copyright">
                            <span>Copyright &copy; 2084 <a href="#">Company Name</a> - <a rel="nofollow" href="http://www.templatemo.com/preview/templatemo_409_travel">Travel</a> by <a rel="nofollow" href="http://www.templatemo.com">templatemo</a></span>
                        </div>
                    </div> <!-- /.col-md-4 -->
                    <div class="col-md-4 col-sm-4">
                        <ul class="social-icons">
                            <li><a href="#" class="fa fa-facebook"></a></li>
                            <li><a href="#" class="fa fa-twitter"></a></li>
                            <li><a href="#" class="fa fa-linkedin"></a></li>
                            <li><a href="#" class="fa fa-flickr"></a></li>
                            <li><a href="#" class="fa fa-rss"></a></li>
                        </ul>
                    </div> <!-- /.col-md-4 -->
                </div> <!-- /.row -->
            </div> <!-- /.container -->
        </div> <!-- /.site-footer -->
        <script src="../resources/js/vendor/jquery-1.11.0.min.js"></script>
        <script>window.jQuery || document.write('<script src="../resources/js/vendor/jquery-1.11.0.min.js"><\/script>')</script>
        <script src="../resources/js/bootstrap.js"></script>
        <script src="../resources/js/plugins.js"></script>
        <script src="../resources/js/main.js"></script>


    </body>
</html>

